<?php
!defined('M_P') && exit('Forbidden');
if(!$winduid) Showmsg('not_login');
InitGP(array('u','page'),'',2);
$uid = $u ? $u : $winduid;
require_once(R_P.'require/showimg.php');

if ($uid != $winduid) {
	$userdb = $db->get_one("SELECT uid,username,icon FROM pw_members WHERE uid=".pwEscape($uid));
	list($faceimg) = showfacedesign($userdb['icon'],1,'s');
	$username	= $userdb['username'];
} else {
	list($faceimg) = showfacedesign($winddb['icon'],1,'s');
	$username	= $windid;
}
$count	= $db->get_value("SELECT COUNT(*) AS count FROM pw_oboard WHERE touid=".pwEscape($uid));
$perpage = $db_perpage;
$page<1 && $page = 1;
$start = ($page-1)*$perpage;
$numofpage = ceil($count/$perpage);

$boards = array();
$query = $db->query("SELECT o.*,m.icon as face FROM pw_oboard o LEFT JOIN pw_members m ON o.uid=m.uid WHERE o.touid=".pwEscape($uid)." ORDER BY o.id DESC ".pwLimit($start,$perpage));
while ($rt = $db->fetch_array($query)) {
	$rt['postdate']	= get_date($rt['postdate']);
	list($rt['face'])	=  showfacedesign($rt['face'],1);
	$boards[] = $rt;
}

$pages = numofpage($count,$page,$numofpage,$basename."q=board&u=".$uid."&");

require_once(R_P.'require/header.php');
require_once PrintEot('m_board');footer();
?>